package com.hue.concurrent.day05;

import java.util.concurrent.locks.LockSupport;

/**
 * 使用park、unpark来控制两个线程的执行顺序
 */
public class Demo04 {
    public static void main(String[] args) {
        Thread t1 = new Thread(() -> {
            LockSupport.park();
            System.out.println("t1执行");
        });
        t1.start();

        new Thread(() -> {
            System.out.println("t2执行");
            LockSupport.unpark(t1);
        }).start();
    }
}
